<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>游戏配置管理器</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background-color: #f5f5f5;
            color: #333;
        }

        .header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 1rem 2rem;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }

        .header h1 {
            font-size: 1.8rem;
            font-weight: 600;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 2rem;
            display: grid;
            grid-template-columns: 300px 1fr;
            gap: 2rem;
            height: calc(100vh - 100px);
        }

        .sidebar {
            background: white;
            border-radius: 12px;
            padding: 1.5rem;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
            overflow-y: auto;
        }

        .sidebar h2 {
            font-size: 1.2rem;
            margin-bottom: 1rem;
            color: #555;
            border-bottom: 2px solid #eee;
            padding-bottom: 0.5rem;
        }

        .config-list {
            list-style: none;
        }

        .config-item {
            padding: 0.8rem 1rem;
            margin-bottom: 0.5rem;
            background: #f8f9fa;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            border-left: 4px solid transparent;
        }

        .config-item:hover {
            background: #e9ecef;
            transform: translateX(4px);
        }

        .config-item.active {
            background: #e3f2fd;
            border-left-color: #2196f3;
            color: #1976d2;
        }

        .main-content {
            background: white;
            border-radius: 12px;
            padding: 2rem;
            box-shadow: 0 4px 20px rgba(0,0,0,0.1);
            overflow-y: auto;
            display: flex;
            flex-direction: column;
        }

        .loading {
            text-align: center;
            padding: 3rem;
            color: #666;
        }

        .spinner {
            border: 3px solid #f3f3f3;
            border-top: 3px solid #3498db;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin: 0 auto 1rem;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .toolbar {
            display: flex;
            gap: 1rem;
            margin-bottom: 2rem;
            align-items: center;
        }

        .btn {
            padding: 0.6rem 1.2rem;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.9rem;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }

        .btn-primary {
            background: #2196f3;
            color: white;
        }

        .btn-primary:hover {
            background: #1976d2;
            transform: translateY(-1px);
        }

        .btn-success {
            background: #4caf50;
            color: white;
        }

        .btn-success:hover {
            background: #388e3c;
            transform: translateY(-1px);
        }

        .config-title {
            font-size: 1.4rem;
            margin-bottom: 1rem;
            color: #333;
        }

        .form-container {
            flex: 1;
            overflow-y: auto;
        }

        .array-item {
            background: #fafafa;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 1rem;
            margin-bottom: 1rem;
            position: relative;
        }

        .array-item-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
            font-weight: 600;
            color: #555;
        }

        .btn-danger {
            background: #f44336;
            color: white;
            padding: 0.4rem 0.8rem;
            font-size: 0.8rem;
        }

        .btn-danger:hover {
            background: #d32f2f;
        }

        .form-group {
            margin-bottom: 1rem;
        }

        .form-label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 500;
            color: #555;
        }

        .form-input {
            width: 100%;
            padding: 0.6rem;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 0.9rem;
            transition: border-color 0.3s ease;
        }

        .form-input:focus {
            outline: none;
            border-color: #2196f3;
            box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
        }

        .form-textarea {
            min-height: 80px;
            resize: vertical;
        }

        .welcome {
            text-align: center;
            padding: 4rem 2rem;
            color: #666;
        }

        .welcome h2 {
            font-size: 1.8rem;
            margin-bottom: 1rem;
            color: #555;
        }

        .status-message {
            padding: 1rem;
            border-radius: 6px;
            margin-bottom: 1rem;
            font-weight: 500;
        }

        .status-success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }

        .status-error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }

        .object-container {
            background: #f5f5f5;
            border-radius: 6px;
            padding: 1rem;
            margin-bottom: 1rem;
        }

        .object-title {
            font-weight: 600;
            color: #666;
            margin-bottom: 0.8rem;
            padding-bottom: 0.5rem;
            border-bottom: 1px solid #ddd;
        }

        .array-container {
            border: 1px solid #e0e0e0;
            border-radius: 6px;
            padding: 1rem;
        }

        .add-item-btn {
            background: #ff9800;
            color: white;
            width: 100%;
            padding: 0.8rem;
            margin-top: 1rem;
        }

        .add-item-btn:hover {
            background: #f57c00;
        }
    </style>
</head>
<body>
    <div class="header">
        <h1>🎮 游戏配置管理器</h1>
    </div>

    <div class="container">
        <div class="sidebar">
            <h2>配置文件</h2>
            <ul id="configList" class="config-list">
                <li class="loading">
                    <div class="spinner"></div>
                    加载中...
                </li>
            </ul>
        </div>

        <div class="main-content">
            <div id="welcomeScreen" class="welcome">
                <h2>欢迎使用游戏配置管理器</h2>
                <p>请从左侧选择一个配置文件开始编辑</p>
            </div>

            <div id="editorScreen" style="display: none;">
                <div class="toolbar">
                    <button id="saveBtn" class="btn btn-success">💾 保存配置</button>
                    <button id="reloadBtn" class="btn btn-primary">🔄 重新加载</button>
                    <span id="currentConfig" class="config-title"></span>
                </div>
                
                <div id="statusMessage"></div>
                
                <div class="form-container">
                    <div id="formContent"></div>
                </div>
            </div>
        </div>
    </div>

    <script src="app.js"></script>
</body>
</html>

